package at.fhooe.mcm12.java.sensors;

import at.fhooe.mcm12.java.enums.SensorType;

public abstract class AbstractSensor<T> {

	protected String m_name;
	protected SensorType m_sensorType;
	protected String m_description;
	protected T m_dataType;
	
	protected boolean m_active;
	
	public static AbstractSensor<?> createSensor(String _name, String _description,
			SensorType _sensorType, Class<?> _dataType)
	{
		if(_sensorType == SensorType.Poll)
		{
			return PollSensor.createSensor(_name, _description, _sensorType, _dataType);
		}
		else
		{
			return PushSensor.createSensor(_name, _description, _sensorType, _dataType);
		}
	}
	
	public String getName()
	{
		return m_name;
	}
	
	public void setName(String _name)
	{
		m_name = _name;
	}
	
	public SensorType getSensorType()
	{
		return m_sensorType;
	}
	
	public void setSensorType(SensorType _sensorType)
	{
		m_sensorType = _sensorType;
	}
	
	public String getDescription()
	{
		return m_description;
	}
	
	public void setDescription(String _description)
	{
		m_description = _description;
	}
	
	public T getDataType()
	{
		return m_dataType;
	}
	
	public void setDataType(T _dataType)
	{
		m_dataType = _dataType;
	}
	
	public boolean isActive()
	{
		return m_active;
	}
	
	public void setActive(boolean _active)
	{
		m_active = _active;
	}
}
